﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebServerConnectorDll
{
    public class Conn
    {
        //public static String URL = "http://localhost:8800/FruitECS/";
        public static String URL = "http://malve-max.imwork.net:8800/FruitECS/";

        public static HttpResponse Post(String lynk, String data = "")
        {
            HttpResponse response = null;
            String result = null;

            try
            {
                result = EasyHelper.C5HttpHelperPostResult(URL + lynk, data);
                String newLine = "\r\n";
                if (result.Substring(0, 4).Contains(newLine))
                {
                    result = result.Substring(newLine.Length);
                }
                response = JSON.parse<HttpResponse>(result);
            }
            catch(Exception e)
            {
                response = new HttpResponse();
                response.TimeOut();
            }
            finally
            {

            }

            return response;
        }
    }
}
